package cn.edu.bcu.ls.controller;

import cn.edu.bcu.ls.entity.Adv;
import cn.edu.bcu.ls.entity.Song;
import cn.edu.bcu.ls.service.AdvService;
import cn.edu.bcu.ls.service.SongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
public class AdvController {

    @Autowired
    private AdvService advService;


    @PostMapping(value = "Adv")
    public boolean InsertSong(Adv adv) {
        return advService.insertSelective(adv) > 0 ? true : false;
    }

    @DeleteMapping(value = "Adv")
    public boolean deleteSong(Integer adv_id) {
        return advService.deleteByPrimaryKey(adv_id) > 0 ? true : false;
    }

    @PutMapping(value = "Adv")
    public boolean updateSong(Adv adv) {
        return advService.updateByPrimaryKeySelective(adv) > 0 ? true : false;
    }

    @GetMapping(value = "Adv")
    public List<Adv> getSong(@RequestParam(required = false) Integer adv_id) {
        return advService.selectByPrimaryKey(adv_id);
    }
}
